package com.example.project.business.extendPoint.BeanPostProcessor;

import java.lang.reflect.Constructor;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor;

/**
* @author Hebojin
* @createTime 2023年2月27日 下午3:33:46
* @Description 类描述
*/

//@Component
public class TestSmartInstantiationAwareBeanPostProcessor implements SmartInstantiationAwareBeanPostProcessor
{
    
    @Override
    public Class<?> predictBeanType(Class<?> beanClass, String beanName) throws BeansException
    {
        if("app".equals(beanName))
        {
            System.out.println(
                    "-----TestSmartInstantiationAwareBeanPostProcessor-----predictBeanType-----------");
        }
        return null;
    }
    
    @Override
    public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName)
            throws BeansException
    {
        if("app".equals(beanName))
        {
            System.out.println(
                    "-----TestSmartInstantiationAwareBeanPostProcessor-----determineCandidateConstructors-----------");
        }
        return null;
    }
    
    @Override
    public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException
    {
        if("app".equals(beanName))
        {
            System.out.println(
                    "-----TestSmartInstantiationAwareBeanPostProcessor-----getEarlyBeanReference-----------");
        }
        return bean;
    }
}
